﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GMap.NET.Projections;
using GMap.NET;
using System.Xml.Linq;

namespace GoogleMapsAPI
{
    public partial class form1 : Form
    {
        public form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MercatorProjection mp = new MercatorProjection();
            Point cp = mp.FromLatLngToPixel(double.Parse(txtlat.Text), double.Parse(txtlng.Text), int.Parse(txtzoom1.Text));
            txtx.Text = cp.X.ToString();
            txty.Text = cp.Y.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MercatorProjection mp = new MercatorProjection();
            PointLatLng cp = mp.FromPixelToLatLng(int.Parse(txtx.Text), int.Parse(txty.Text), int.Parse(txtz.Text));
            txtlat.Text = cp.Lat.ToString();
            txtlng.Text = cp.Lng.ToString();

        }

        private void form1_Load(object sender, EventArgs e)
        {

        }
    }
}
